package com.sky.service.impl;


import com.sky.result.Result;
import com.sky.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class ShopUserServiceImpl implements ShopService {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;


    /**
     * 查询店铺营业状态
     *
     * @return
     */
    @Override
    public Result<Integer> getStatus() {
        Integer shop_status = Integer.parseInt(stringRedisTemplate.opsForValue().get("SHOP_STATUS"));
        System.out.println(shop_status);
        return Result.success(shop_status);
    }

    /**
     * 修改店铺状态
     *
     * @param status
     * @return
     */
    @Override
    public Result changeShopStatus(Integer status) {
        stringRedisTemplate.opsForValue().set("SHOP_STATUS", status.toString());
        return Result.success();
    }
}
